package com.kanshu.basictest.ui.activity;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;

import com.kanshu.basictest.R;
import com.kanshu.basictest.model.menu.MenuItem;
import com.kanshu.basictest.ui.activity.basic.BasicIndexActivity;
import com.kanshu.basictest.ui.activity.ipc.IPCIndexActivity;
import com.kanshu.basictest.ui.activity.message.HandlerIndexActivity;
import com.kanshu.basictest.ui.activity.thread.ThreadIndexActivity;
import com.kanshu.basictest.ui.activity.system.SystemIndexActivity;
import com.kanshu.basictest.ui.activity.view.ViewIndexActivity;
import com.kanshu.basictest.ui.base.BaseListMenuActivity;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends BaseListMenuActivity {


    @Override
    protected String provideBarTitle() {
        return "AndroidBasicTest";
    }

    public static final String TAG = "MainActivity";

    @Override
    protected List<? extends MenuItem> provideMenuData() {
        List<MenuItem> menuItems = new ArrayList<>();
        menuItems.add(0, new MenuItem("基础", R.color.brown_300));//实例应用
        menuItems.add(1, new MenuItem("View", R.color.brown_300));//实例应用
        menuItems.add(2, new MenuItem("IPC", R.color.brown_300));//实例应用
        menuItems.add(3, new MenuItem("Android的消息机制", R.color.brown_300));//实例应用
        menuItems.add(4, new MenuItem("Android中的线程和线程池", R.color.brown_300));//实例应用
        menuItems.add(5, new MenuItem("系统信息的相关测试", R.color.brown_300));//实例应用
        return menuItems;
    }

    @Override
    protected void init() {
        super.init();
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
        Intent intent = new Intent();
        switch (position) {
            case 0://基础
                intent.setClass(this, BasicIndexActivity.class);
                break;
            case 1://基础
                intent.setClass(this, ViewIndexActivity.class);
                break;
            case 2://基础
                intent.setClass(this, IPCIndexActivity.class);
                break;
            case 3://基础
                intent.setClass(this, HandlerIndexActivity.class);
                break;
            case 4://基础
                intent.setClass(this, ThreadIndexActivity.class);
                break;
            case 5://基础
                intent.setClass(this, SystemIndexActivity.class);
                break;
            default:
                break;

        }

        startActivity(intent);
    }
}
